﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using PHMEE.DTOS.BaseSys;
using System;
using System.Threading.Tasks;

namespace PHMEE.Controllers.Auth
{
    /// <summary>
    /// 系统登录🚢🌞🌛✨
    /// </summary>
    [Route("api/auth")]
    public class AuthController : PHMEEController
    {
        private readonly IAuthAppService authService;

        public AuthController(IAuthAppService authService)
        {
            this.authService = authService;
        }

        [AllowAnonymous]
        [HttpPost]
        [Route("Login")]
        public async Task<UserResultDto> Login(UserLoginDto dto)
        {
            return await authService.Login(dto);
        }

        [AllowAnonymous]
        [HttpPost]
        [Route("RefreshToken")]
        public async Task<UserResultDto> RefreshToken(UserRefreshDto dto)
        {
            return await authService.RefreshToken(dto);
        }

        [HttpPost]
        [Route("GetInitialVessel")]
        public async Task<VesselInitialDto> GetInitialVessel(VesselInitialInput input)
        {
            return await authService.GetInitialVessel(input);
        }

    }
}
